local StartSelfRes = 0
local StartTeamRes = 0 
local TotalHeight = 35
local FONT = "Default"

hook.Add("InitPostEntity", "PreProcessResources", function()
	
	local TextHeight = 	draw.GetFontHeight( FONT )
	
	StartSelfRes = TotalHeight * 0.25 - TextHeight * 0.5
	StartTeamRes = TotalHeight * 0.75 - TextHeight * 0.5

end )

local function GetCommRes()

	local comm = team.GetComm( LocalPlayer():Team() )

	if IsValid( comm ) then
		return comm:GetRes() or 0
	end
	
	return 0
	
end

hook.Add("HUDPaint", "DrawResources", function()

	local Start = ScrH() - 120
	
	draw.RoundedBox( 
		8,
		20,
		Start,
		130,
		TotalHeight,
		Color( 120, 120, 120, 150 )
	)
	
	surface.SetFont( FONT )
	surface.SetTextColor( 255, 255, 255, 255 )
	
	surface.SetTextPos( 30, Start + StartSelfRes )
	surface.DrawText("Your resource: " )
	
	surface.SetTextPos( 110, Start + StartSelfRes )
	surface.DrawText( LocalPlayer():GetRes() )
	
	surface.SetTextPos( 30, Start + StartTeamRes )
	surface.DrawText("Team resource: " )
	
	surface.SetTextPos( 110, Start + StartTeamRes )
	surface.DrawText( GetCommRes() )

end )